Skip to content

Automatically set detached state as needed.#925

Merged
feoh merged 3 commits into
nvim-lua:masterfrom
PerMalmberg:fix-delve-for-windows
May 10, 2024
Merged

Automatically set detached state as needed.#925
feoh merged 3 commits into
nvim-lua:masterfrom
PerMalmberg:fix-delve-for-windows

Conversation

@PerMalmberg

Copy link
Copy Markdown
Contributor

Hi,

Here's a fix to automatically set the detached state for delve based on the OS. Gives a better first-time experience when delve doesn't crash :)

Comment thread lua/kickstart/plugins/debug.lua Outdated
@PerMalmberg

Copy link
Copy Markdown
Contributor Author

Updated as requested, works on my machine :)

Comment thread lua/kickstart/plugins/debug.lua Outdated
delve = {
-- On Windows delve must be run attached or it crashes.
-- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring
detached = not vim.fn.has 'win32',

@dam9000 dam9000 May 10, 2024

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I think this will always be false
vim.fn.has will return 0 or 1, and in lua not 0 and not 1 will both be false
so I think this needs to be:

detached = vim.fn.has 'win32' == 0,

can you please test that?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, Lua does that funny thing with numbers and boolean ops. My bad, will fix.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@dam9000 dam9000 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@feoh feoh merged commit 5aeddfd into nvim-lua:master May 10, 2024
@PerMalmberg PerMalmberg deleted the fix-delve-for-windows branch May 10, 2024 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants